package com.kumarn.android.drovoice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Vibrator;
import android.widget.Toast;

public class BatteryBroadcastReceiver extends BroadcastReceiver{

	@Override
	public void onReceive(Context c, Intent in) {

		int scale = 100;
		int level = 0;

		String ac = in.getAction();
		if (ac.equals(Intent.ACTION_BATTERY_CHANGED)) {
			level = in.getIntExtra("level", 0);
			scale = in.getIntExtra("scale", 0);
		}

		Toast.makeText(c, ""+level+"/"+scale, Toast.LENGTH_SHORT).show();

		Vibrator vibrator = (Vibrator) c.getSystemService(Context.VIBRATOR_SERVICE);
		vibrator.vibrate(200);

		//音声再生
		//MediaPlayer mediaPlayer = MediaPlayer.create(VolVoiceService.this,R.raw.hakurei);
		//mediaPlayer.start();
	}

}